* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: #000;
}

section {
    position: relative;
    width: 150px;
    height: 150px;
    /* 让子元素保留其 3D 位置 */
    transform-style: preserve-3d;
    animation: rotate 5s linear infinite;
    /* 视距：增加盒子的立体感 */
    perspective: 1000px;
}

section div {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    transition: all 1s;
}

section div img {
    width: 100%;
    height: 100%;
}

section div:nth-of-type(1) {
    transform:  translateZ(75px);
}

section:hover div:nth-of-type(1) {
    transform: translateZ(200px);
}

section div:nth-of-type(2) {
    transform: rotateX(-180deg) translateZ(75px);
}
section:hover div:nth-of-type(2) {
    transform: rotateX(-180deg) translateZ(200px);
}

section div:nth-of-type(3) {
    transform: rotateX(90deg) translateZ(75px);
}
section:hover div:nth-of-type(3) {
    transform: rotateX(90deg) translateZ(200px);
}

section div:nth-of-type(4) {
    transform: rotateX(-90deg) translateZ(75px);
}
section:hover div:nth-of-type(4) {
    transform: rotateX(-90deg) translateZ(200px);
}

section div:nth-of-type(5) {
    transform: rotateY(90deg) translateZ(75px);
}
section:hover div:nth-of-type(5) {
    transform: rotateY(90deg) translateZ(200px);
}

section div:nth-of-type(6) {
    transform: rotateY(-90deg) translateZ(75px);
}

section:hover div:nth-of-type(6) {
    transform: rotateY(-90deg) translateZ(200px);
}

section div:nth-of-type(7) {
    transform: translateZ(75px);
}

section div:nth-of-type(8) {
    transform: rotateX(-180deg) translateZ(75px);
}

section div:nth-of-type(9) {
    transform: rotateX(90deg) translateZ(75px);
}

section div:nth-of-type(10) {
    transform: rotateX(-90deg) translateZ(75px);
}

section div:nth-of-type(11) {
    transform: rotateY(90deg) translateZ(75px);
}

section div:nth-of-type(12) {
    transform: rotateY(-90deg) translateZ(75px);
}

@keyframes rotate {
    0% {
        transform: rotateY(0) rotateX(0);
    }
    100% {
        transform: rotateY(360deg) rotateX(360deg);
    }
}
